from fastmcp import FastMCP
from pydantic import Field
import asyncio

# Create MCP server
mcp = FastMCP("MCP Tools")

@mcp.tool()
async def echo_test(
    prompt: str = Field(description="文本描述"), 
) -> dict:
    """
    测试mcp功能
    """
    _loop = asyncio.get_event_loop()
    # 可以在这里启动异步任务
    # _loop.create_task(...)
    return {"success": True, "result": f"测试完成, 收到{prompt}"}


# Create ASGI app from MCP server
mcp_app = mcp.http_app(path="/mcp")